package com.colbby.datahouse.transform;

import com.colbby.datahouse.utils.CastUtils;
import com.colbby.datahouse.utils.TypeDescriptor;
import com.colbby.datahouse.utils.TypeUtils;

public class LongTransformer implements DataTypeTransform<Long> {

	public static final LongTransformer INSTANCE = new LongTransformer();
	
	@Override
	public Long transform(TypeDescriptor returnType, Object value) {
		return CastUtils.castToLong(CastUtils.getValue(value));
	}

	@Override
	public boolean shouldDo(TypeDescriptor returnType, Object value) {
		return TypeUtils.isSuperClass(Long.class, returnType.getTypeClass());
	}

}
